<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<pre>',
                    '^hello\n\nworld\n\nwebkit\n|',
                '</pre>',
            '</div>',
        ].join(''),
        'formatBlock h3',
        [
            '<div contenteditable>',
                '<h3>',
                    'hello<br>\nworld<br>\nwebkit',
                '</h3>|',
            '</div>',
        ].join('')),
        'formatBlock on all contents with H3');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<pre>',
                    '^hello\n\nworld\n\n|webkit\n',
                '</pre>',
            '</div>',
        ].join(''),
        'formatBlock h3',
        [
            '<div contenteditable>',
                '<pre>',
                    '<h3>^hello\nworld\n</h3>|webkit\n',
                '</pre>',
            '</div>',
        ].join('')),
        'formatBlock on last paragraph with H3');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<pre>',
                    'hello\n^\nworld\n\nwebkit\n|',
                '</pre>',
            '</div>',
        ].join(''),
        'formatBlock h3',
        [
            '<div contenteditable>',
                '<pre>',
                    'hello\n<h3>\nworld\nwebkit</h3>|',
                '</pre>',
            '</div>',
        ].join('')),
        'formatBlock all but the first paragraph with H3');
</script>
